package com.rayboo.tasks;

import javax.servlet.ServletContext;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import com.rayboo.util.DateTool;

/**
 * 
 * ScheduledTasks
 * 
 * @author ray
 * @date 2016年9月8日 下午8:12:58
 *
 */
@Component
public class ScheduledTasks {

	@Autowired
	private ServletContext servletContext;

	@Scheduled(fixedRate = 1000 * 360 * 24)
	public void reportCurrentTime() {
		servletContext.setAttribute("time", DateTool.getDateTime());
		System.out.println("现在时间：" + DateTool.getDateTime());
	}
}
